<template>
  <div class="containt">
    <nav-com
      :title="title"
      :showView='showView'
      @back="backHandler()"
    ></nav-com>
    <!-- <van-tabs> -->
    <!-- <van-tab
        v-for="index in 3"
        :title="'标签 ' + index"
        :key="index"
      > -->
    <div class="goods-list">
      <div
        v-for="item in list"
        :key="item.id"
        class="good-box"
        @click="handerDetails(item.id)"
      >
        <img
          style="height:40vw;width:100%"
          :src="item.image"
        >
        <div style="margin:10px">
          <div style="font-size:18px">{{item.title}}</div>
          <!-- <div style="font-size:12px;color:#ccc;line-height:16px">已售{{item.total_sales}}件</div> -->
          <div style="border:1px solid #F84C5A; color:#F84C5A; font-size:10px; width:13vw">全场包邮</div>
          <div>
            <span style="color:#F84C5A; font-size:18px;">￥{{item.price}} </span>
            <span style="color:#333; font-size:12px; text-decoration: line-through; margin-top:10px">￥{{item.original_price}}</span>
            <img
              style="float:right; height:20px"
              src="../../assets/my/car.png"
              alt=""
            >
          </div>
        </div>
      </div>
    </div>
    <!-- </van-tab>
    </van-tabs> -->
  </div>
</template>

<script>
import { getBagIdItem2, yiPayTip } from "@/api/api";
import navCom from "@/component/nav";
export default {
  components: {
    navCom,
  },
  data() {
    return {
      showView: true,
      list: [],
      title: "",
      one_day: 1,
    };
  },
  created() {
    this.title = "每月一品" ;
    this.init();
    // this.isTip()
  },
  methods: {
    isTip(){
      yiPayTip().then(res=>{
        if(res.data.data['status'] == 'true'){
          this.$dialog.alert({
            title:"支付提示",
            message:'亲！您有未完成预付券支付的订单，请您及时支付，完成订单'
          }).then(()=>{
          })
        }
      })
    },
    backHandler() {
      if(weixin.isAndroid()){
        window.JS_TROOPS.goBack()
      }else{
        this.$router.go(-1);
      }
      
    },
    //跳转详情
    handerDetails(id) {
      this.$router.push({
        name: "odersDetails",
        params: { id: id, one_day: 1 },
      });
    },
    //初始化s
    init() {
      getBagIdItem2({
        page: "1",
        per_page: 50,
        keywords: "",
        one_day: 1,
      }).then((res) => {
        this.list = res.data.data.data;
      });
    },
  },
};
</script>

<style scoped>
.containt {
  background: #f1f3f6;
  min-height: 100vh;
}
.goods-list {
  margin: 3.3vw;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
}
.goods-list .good-box {
  margin-bottom: 4vw;
  min-height: 250px;
  width: 45vw;
  background: #fff;
}
</style>